<!DOCTYPE html>
<html lang="zh">
<head>
    {{template "header" (ossUrl)}}
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-job-edit">
        <input id="jobId" name="jobId" type="hidden" value="{{.job.JobId}}"/>
        <input type="hidden" name="updateBy" value="{{.loginName}}}">
        <div class="form-group">
            <label class="col-sm-3 control-label">任务名称：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="jobName" id="jobName" value="{{.job.JobName}}" required>
                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 请输入纯英文字母</span>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">任务分组：</label>
            <div class="col-sm-8">
                {{getDictTypeSelect "sys_job_group" "jobGroup" "jobGroup" "" .job.JobGroup "" ""}}
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">执行方法名：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="invokeTarget" id="invokeTarget" value="{{.job.InvokeTarget}}" required>
                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>方法名 示例：test1</span>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">执行参数：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="jobParams" id="jobParams" value="{{.job.JobParams}}" required>
                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>以|分隔多个参数 示例：param1|param1</span>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">cron表达式：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="cronExpression" id="cronExpression" value="{{.job.CronExpression}}" required>
                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 0 30 * * * *：每30分钟执行一次</span>
                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> * * * * * *：每秒执行一次</span>
                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> @hourly：每小时执行一次</span>
                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> @every 1h30m：每1个半小时执行一次</span>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">执行策略：</label>
            <div class="col-sm-8">
                <label class="radio-box"> <input type="radio" {{if eq .job.MisfirePolicy "1"}}checked="true"{{end}} name="misfirePolicy" value="1"/>
                    重复执行 </label>
                <label class="radio-box"> <input type="radio" {{if eq .job.MisfirePolicy "2"}}checked="true"{{end}} name="misfirePolicy" value="2"/>
                    执行一次 </label>
            </div>
        </div>
        <div class="form-group" style="display: none">
            <label class="col-sm-3 control-label">并发执行：</label>
            <div class="col-sm-8">
                <label class="radio-box"> <input type="radio" {{if eq .job.Concurrent "0"}}checked="true"{{end}} name="concurrent" value="0"/> 允许
                </label>
                <label class="radio-box"> <input type="radio" {{if eq .job.Concurrent "1"}}checked="true"{{end}} name="concurrent" value="1"/> 禁止
                </label>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">备注：<input type="hidden" id="status" name="status" value="{{.job.Status}}"/></label>
            <div class="col-sm-8">
                <textarea id="remark" name="remark" class="form-control">{{.job.Remark}}</textarea>
            </div>
        </div>
    </form>
</div>
{{template "footer" (ossUrl)}}
<script type="text/javascript">
    var prefix = ctx + "monitor/job";

    $("#form-job-edit").validate({
        onkeyup: false,
        rules: {},
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-job-edit').serialize());
        }
    }
</script>
</body>
</html>
